/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.siseventos.view.util;

import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;

/**
 *
 * @author marcosnatanpacheco
 */
public class MessageHelper {

    private static FacesMessage msg = null;

    public static void showGlobalMessage(String message, Severity level) {
        getMsg().setSummary(message);
        getMsg().setSeverity(level);
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }

    private static FacesMessage getMsg() {
        if (msg == null) {
            msg = new FacesMessage();
        }
        return msg;
    }
}
